﻿using AutoMapper;
using HamcoWcs.Contract.ContractMes;
using HamcoWcs.DAL;
using HamcoWcs.Models.Common.Enums;
using HamcoWcs.Models.Devices;

namespace HamcoWcs.Service.Pcon.PconPlcDbMsgParsers
{
    public class PconMsgParse_Full : PconMsgParseBase
    {
        public override EnumPconPlcRequest RequestType => EnumPconPlcRequest.Full;


        public PconMsgParse_Full(WcsDbContext wcsDbContext, IMapper mapper, IMesCommunicateService mesCommunicateService)
            : base(mesCommunicateService, wcsDbContext, mapper)
        {
        }

        public override void Deal(PconDto pconDto, PconPlc pconPlc)
        {
            if (pconDto.PconType == EnumPconType.Wharf && pconDto.WorkType == 1)
            {
                _mesCommunicateService.ChangeMachinePalletTypeRequest(pconDto, "FULL");
            }
            else
            {
                RejectChangePalletType(pconDto);
            }
        }
    }
}
